package com.nbsaas.boot.project.rest.resource;

import com.nbsaas.boot.project.api.apis.DataModelFieldApi;
import com.nbsaas.boot.project.data.entity.DataModelField;
import com.nbsaas.boot.project.api.domain.request.DataModelFieldRequest;
import com.nbsaas.boot.project.api.domain.response.DataModelFieldResponse;
import com.nbsaas.boot.project.api.domain.simple.DataModelFieldSimple;
import com.nbsaas.boot.project.rest.convert.DataModelFieldSimpleConvert;
import com.nbsaas.boot.project.rest.convert.DataModelFieldEntityConvert;
import com.nbsaas.boot.project.rest.convert.DataModelFieldResponseConvert;
import com.nbsaas.boot.project.data.repository.DataModelFieldRepository;

import java.io.Serializable;
import com.nbsaas.boot.jpa.data.core.BaseResource;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import org.springframework.data.jpa.repository.support.JpaRepositoryImplementation;

import java.util.function.Function;
/**
*   业务接口实现
*/
@Transactional
@Service
public class DataModelFieldResource extends BaseResource<DataModelField,DataModelFieldResponse, DataModelFieldSimple, DataModelFieldRequest>  implements DataModelFieldApi {

    @Resource
    private DataModelFieldRepository dataModelFieldRepository;

    @Override
    public JpaRepositoryImplementation<DataModelField, Serializable> getJpaRepository() {
        return dataModelFieldRepository;
    }

    @Override
    public Function<DataModelField, DataModelFieldSimple> getConvertSimple() {
        return new DataModelFieldSimpleConvert();
    }

    @Override
    public Function<DataModelFieldRequest, DataModelField> getConvertForm() {
        return new DataModelFieldEntityConvert();
    }

    @Override
    public Function<DataModelField, DataModelFieldResponse> getConvertResponse() {
        return new DataModelFieldResponseConvert();
    }




}


